<?php
/**
 * Created by PhpStorm.
 * User: pc
 * Date: 2018/1/10
 * Time: 10:23
 */

namespace Lib\Base;


use Dingo\Api\Routing\Helpers;

trait Response
{
    use Helpers;
    protected function message($data) {
        return [
            'msg' => $data,
            "code"=>200
        ];
    }
    protected function success($data) {
        return [
            'msg' => $data,
            "code"=>200
        ];
    }
    public function data($data) {
        return [
            'data' => $data==null?[]:$data,
            ];
    }
    public function error($message,$statusCode=500){
        $this->response->error($message,$statusCode);
    }
}